#include <execinfo.h>
#include "fdutil.hpp"
#include "syscalls/cio.h"
//#include "backtracpp/trace.h"
//#include "utils/logging.hpp"

using namespace cerb;

FDWrapper::~FDWrapper()
{
    close();
}

bool FDWrapper::closed() const
{
    return fd == -1;
}

void FDWrapper::close()
{
    if (!closed()) {
        cio::close(fd);
        fd = -1;
    }
}
